package com.hkd.product_service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hkd.common.api.ApiResponse;
import com.hkd.product_service.api.dto.InsertSupplierDTO;
import com.hkd.product_service.mapper.SupplierInfoMapper;
import com.hkd.product_service.api.SupplierInfoService;
import com.hkd.product_service.api.entity.SupplierInfo;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author HKD
 * @date 2022/9/17 22:08
 */
@RestController
public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, SupplierInfo> implements SupplierInfoService {
    @Override
    public ApiResponse insertSupplier(String curUserId, InsertSupplierDTO param) {
        SupplierInfo supplier = BeanUtil.copyProperties(param, SupplierInfo.class);
        supplier.setCreateId(curUserId);
        supplier.setUpdateId(curUserId);
        this.save(supplier);
        return ApiResponse.ok();
    }
}
